﻿using HashFoo.Rest.Server;

namespace HashFooRest.App.Web.Config
{
    public class HandlerNinjectModule : Ninject.Modules.NinjectModule
    {
        public override void Load()
        {
            var handlers = ServiceHandlerUtil.GetServiceHandlerImplementations(GetType().Assembly);

            foreach (var handler in handlers)
            {
                var handlerInterfaces = ServiceHandlerUtil.GetServiceHanlderInterfaces(handler);
                foreach (var handlerInterface in handlerInterfaces) Bind(handlerInterface).To(handler);
            }
        }
    }
}